// import com.alibaba.druid.sql.ast.SQLName;
// import com.alibaba.druid.sql.ast.SQLObject;
// import com.alibaba.druid.sql.ast.SQLObjectImpl;
// import com.alibaba.druid.sql.visitor.SQLASTVisitor;

// import java.util.ArrayList;
// import java.util.List;

#include "SQLAlterTableReOrganizePartition.h"
#include "../../visitor/SQLASTVisitor.h"

SQLAlterTableReOrganizePartition::SQLAlterTableReOrganizePartition()
{
  names = std::make_shared<std::list<SQLName_ptr>>();
  partitions = std::make_shared<std::list<SQLObject_ptr>>();
}
SQLObject_list_ptr SQLAlterTableReOrganizePartition::getPartitions()
{
  return partitions;
}

void SQLAlterTableReOrganizePartition::addPartition(SQLObject_ptr partition)
{
  if (partition != nullptr)
  {
    partition->setParent(SharedObject(SQLAlterTableReOrganizePartition));
  }
  this->partitions->push_back(partition);
}

SQLName_list_ptr SQLAlterTableReOrganizePartition::getNames()
{
  return names;
}

// @Override
void SQLAlterTableReOrganizePartition::accept0(SQLASTVisitor_ptr visitor)
{
  if (visitor->visit(SharedObject(SQLAlterTableReOrganizePartition)))
  {
    acceptChild(visitor, partitions);
  }
  visitor->endVisit(SharedObject(SQLAlterTableReOrganizePartition));
}
